import { computed, makeAutoObservable, observable } from 'mobx'

export class Store {
  constructor() {
    makeAutoObservable(this)
  }

  @observable
  count: number = 0

  inc() {
    this.count--
  }

  add() {
    this.count++
  }

  @computed get currentCount() {
    return this.count
  }
}

export const rootStore = new Store()

export function useStore() {
  return rootStore
}
